package org.nepu.scr.indexrate.vo.drillingrate.keydevice.fixedcontrolsystem.fixedcontrolsystem;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.drillingrate.keydevice.fixedcontrolsystem.VibratingScreen;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class VibratingScreenConverter implements AttributeConverter<VibratingScreen, String> {
    @Override
    public String convertToDatabaseColumn(VibratingScreen vibratingScreen) {
        return JSONUtil.toJsonStr(vibratingScreen);
    }

    @Override
    public VibratingScreen convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, VibratingScreen.class);
    }
}
